home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / textyl / src / defs.h < prev    next >
C/C++ Source or Header  |  1993-11-07  |  6KB  |  209 lines

  1. #include    <stdio.h>
  2. #include    <string.h>
  3. #include    <ctype.h>
  4. #include    <math.h>
  5. #include    <setjmp.h>
  6.  
  7. #ifdef    __STDC__
  8. #define        PP(x)    x
  9. #else
  10. #define        PP(x)    ()
  11. #endif
  12.  
  13. #define        false    0
  14. #define        true    1
  15.  
  16. #define TylVersion      "This is TeXtyl, Version 1.30"
  17. /* for dvi-commands */
  18.  
  19. #define    DEFTEXFONTS    "/n/l/u/kin/lib/tex/tfm"
  20.  
  21. #define SET1            128
  22. #define PUT1            133
  23. #define PUTRULE         137
  24. #define NOP             138
  25. #define PUSH            141
  26. #define POP             142
  27. #define RIGHTLEFT       143
  28. #define DOWNUP          157
  29. #define FONTDEF         244
  30. #define USEFONT         236
  31.  
  32. #define USESTDAREA      0
  33.     /* flag to use the 'standard' area to find .tfm files */
  34.  
  35. /* some conversions and numbers */
  36.  
  37. #define TWO16           65536   /* 2 ^ 16 */
  38. #define TWO20           1048576   /* 2 ^ 20 */
  39. #define TWO23           8388608
  40. #define TWO24           16777216
  41. #define TWO27           134217728
  42. #define TWO31           2147483647   /* 2^31 - 1 */
  43.  
  44. #define SPPERPT         65536   /* scaled points per printers point */
  45. #define SPPERMM         186468   /* scaled pts per millimetre */
  46.  
  47. #define RADTODEG        57.29577952   /* degrees per radian */
  48. #define DEGTORAD        0.0174532925   /* radians per degree */
  49. #define PI              3.141592654
  50.  
  51. #define BIGREAL         1.0e30
  52.  
  53. #define MAXCTLPTS       63   /* max number of control points */
  54. #define MAXCTLPTSp3     66   /* max control points + 3 */
  55. #define ARRLIMIT        100   /* limit for strings and other arrays */
  56. #define MAXSPLINESEGS   480   /* max number of spline segments */
  57. #define MAXTBDs         50   /* max number of Fonts-to-be-Defined */
  58. #define MAXVECLENsp     262144
  59. /*  Normal maximum length of longest
  60.  *  vector-font character in scaled points
  61.  */
  62.  
  63. #define OURFONTFLAG     256   /* our special 'byte' value flag */
  64. /* Music Font dependent constants */
  65.  
  66. #define DOTCHAR         127   /* ascii number of char that is a dot */
  67.  
  68. #define QNOTEGHUS       18.0
  69.     /* MF: Global Horizontal Units for a Quarternote */
  70. #define QNOTEGVUS       16.0
  71.     /* MF: Global Vertical units for a quarternote */
  72. #define GBMGHUS         12.0   /* MF: horizontal units for a grace beam */
  73. #define GBMGVUS         9.0
  74.  
  75. #define BMSTART         0
  76. #define BMEND           69   /* indices for start/end of the beam chars */
  77. #define LOBM1           0   /* indices for the regular beam chars that */
  78. #define HIBM1           34   /*   are 1 quarternote long, and */
  79. #define LOBM1p5         35   /*   for those that are 1.5 quarternotes long */
  80. #define HIBM1p5         69
  81.  
  82. #define GBMSTART        70
  83. #define GBMEND          105   /* indices for the grace beams */
  84. #define LOGBMp5         70   /* indices for grace beam chars that */
  85. #define HIGBMp5         87   /* are 0.5 grace quarternote long, and */
  86. #define LOGBMp66        88   /* 0.66 grace quarternotes long */
  87. #define HIGBMp66        105
  88.  
  89. #define LoVThick        1   /* Bounds for Vector char thicknesses */
  90. #define HiVThick        13
  91.  
  92. #define SizVFontTable   39
  93. /* size of the Vector Font Table */
  94. /* 3*HiVThick */
  95. #define SizMFontTable   18   /* size of the Music Font Table */
  96. #define MAXLABELFONTS   5
  97. #define SizLFontTable   MAXLABELFONTS   /* size of the Label Font Table */
  98.  
  99. #define TFMSIZE         8000   /* size of TFM array to hold .tfm file info */
  100.  
  101. /* Numeric names for the TeXtyl primitives */
  102. #define Aline           1   /* should be first */
  103. #define Aspline         2
  104. #define Attspline       3
  105. #define Abeam           4
  106. #define Atieslur        5
  107. #define Aarc            6
  108. #define Alabel          7
  109. #define Afigure         8   /* should be last one */
  110.  
  111. #define MAXFONTS        60   /* number of TeX fonts to keep track of */
  112. #define STACKSIZE       50   /* size of stack for pushes and pops */
  113. #define AREALENGTH      19   /* see also "sysdependent" proc for this value*/
  114.  
  115. #define ERRSIGNAL       '?'
  116. #define ERRNOTBAD       0
  117. #define ERRBAD          1
  118. #define ERRREALBAD      2
  119.  
  120. typedef int int32;
  121. typedef int ScaledPts;
  122. typedef int ControlPoints[MAXCTLPTSp3 + 1][2];
  123. typedef int VecIndex;
  124. typedef char VThickness;
  125. typedef VThickness ThickAryType[MAXSPLINESEGS + 1];
  126. typedef enum {
  127.   VKCirc, VKVert, VKHort
  128. } VectKind;
  129. typedef enum {
  130.   regular, grace
  131. } BeamKind;
  132. typedef enum {
  133.   BSPL, INTBSPL, CATROM, CARD
  134. } SplineKind;
  135. typedef enum {
  136.   solid, dotted, dashed, dotdash
  137. } LineStyle;
  138.  
  139. typedef char charstring[ARRLIMIT];
  140.  
  141. typedef struct Item {
  142.   struct Item *nextitem;
  143.   int32 BBlx, BBby, BBrx, BBty;   /* Bounding box */
  144.   int itemthick, itemvec;
  145.   int itempatt;
  146.   int kind;
  147.   union {
  148.     struct {
  149.       int32 lx1, ly1, lx2, ly2;
  150.     } U1;
  151.     struct {
  152.       int spltype;
  153.       int sclosed;
  154.       int32 dosmarks, nsplknots;
  155.       ControlPoints spts;
  156.     } U2;
  157.     struct {
  158.       int tspltype;
  159.       int tclosed;
  160.       int32 dottmarks, nttknots;
  161.       ControlPoints ttpts;
  162.       ThickAryType ttarry;
  163.     } U3;
  164.     struct {
  165.       int32 bx1, by1, bx2, by2, staf;
  166.       int bkind;
  167.     } U4;
  168.     struct {
  169.       int32 ntknots;
  170.       int minth, maxth;
  171.       ControlPoints tspts;
  172.     } U5;
  173.     struct {
  174.       int32 acentx, acenty, aradius, firstang, lastang, narcknots;
  175.       ControlPoints arcpts;
  176.     } U6;
  177.     struct {
  178.       int32 labx, laby, fontstyle;
  179.       charstring labeltext;
  180.     } U7;
  181.     struct {
  182.       double figtheta, fsx, fsy;
  183.       int32 fdx, fdy, preWid, preHt, postWid, postHt, depthnumber;
  184.       struct Figure *body;
  185.     } U8;
  186.   } UU;
  187. } Item;
  188.  
  189. typedef struct Figure {
  190.   Item *things;
  191. } Figure;
  192.  
  193. typedef struct {
  194.   int32 num;
  195.   char name[32];
  196.   int32 checksum, scaledsize, designsize, space, bc, ec;
  197.   ScaledPts widths[128];
  198. } fontinfo;
  199.  
  200. /* label fonts info */
  201.  
  202. typedef struct {
  203.   int32 DesSize;
  204.   charstring FontName;
  205.   int32 Cksum;
  206.   int Isdefined;
  207.   int32 DVIFontNum, internalnumber, spacewidth;
  208. } LabFontInfRec;
  209.